<?php
class BpdRecordSet
{
/**
 * La requete qui genere ce set
 */
public $sql;
/**
 * Resultat mysql
 */
public $result;
/**
 * Base mysql
 */
public $db;

/**
 * Constructeur
 */
function __construct($psql)
{
	$this->sql = $psql;
	$this->db = $GLOBALS['bpd_db'];
	$this->result = $this->db->Query($psql);
}

function NewRecord()
{
	return new BpdRecord();
}

/**
 * Affichage des resultats en texte brut
 */
function TabTexte()
{
	$fields = mysqli_fetch_fields($this->result);
	echo '|';
	foreach ($fields as $field) {
		echo str_pad($field->name,14).'|';
	}
	echo "\n";
	while ($row = $this->result->fetch_assoc() ) {
		$rec = $this->NewRecord();
		$rec->Read($row);
		$rec->TabTexte();
	}
}
}// class Bpd_RecordSet
?>